<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <link rel="stylesheet" href="./css/zTreeStyle/zTreeStyle.css" />
    <script src="./js/jquery-3.6.0.js"></script>
    <script src="./js/jquery.ztree.all.min.js"></script>
  </head>
  <body>
    <div id="nav">
      <ul id="tree" class="ztree"></ul>
    </div>
  </body>
</html>
<script>
  $(function () {
    //对象配置信息
    var settings = {}
    //数据
    var data = [
      {
        name: '基本信息管理',
        children: [
          {
            name: '人员管理',
            children: [{ name: '人员列表' }, { name: '新增人员' }],
          },
        ],
      },
      {
        name: '基本信息管理2',
        children: [
          {
            name: '人员管理2',
            children: [{ name: '人员列表2' }, { name: '新增人员2' }],
          },
        ],
      },
    ]
    //核心方法
    // param1 数据显示  param2 配置信息  param3显示数据
    $.fn.zTree.init($('#tree'), settings, data)
  })
</script>
